<?php 
include_once(''.P.'/public/header.html');
?>

<script type="text/javascript" src="res/js/jquery-changeuser.js"></script>

<script>
var fieldsarr = <?=json_encode($fieldsobj)?>;

function save(o1){
	var da = js.getformdata(),fid,fd;
	for(fid in fieldsarr){
		fd = fieldsarr[fid];
		if(form(fid) && fd.isbt=='NO' && !da[fid]){
			js.setmsg(''+fd.name+'不能为空');
			form(fid).focus();
			return;
		}
	}
	
	js.setmsg('保存中...');
	o1.disabled=true;
	js.ajax({
		type:'post',
		url:'?m=chat&a=savecheck&d=manage&cnum='+cnum+'',
		data:da,
		success:function(res){
			if(res=='ok'){
				js.back();
			}else{
				js.setmsg(res);
				o1.disabled=false;
			}
		}
	});
}
</script>
</head>

<body style="background:#f1f1f1">

<?php 
include_once(''.P.'/public/top_manage.html');
?>

<div align="center">

<div style="width:<?=$maxwidth?>;margin:20px 0px" align="left">
	<div style="color:#cccccc">
		<a href="?d=manage&cnum=<?=$cnum?>" class="zhu"><?=lang('manage.home')?></a> &gt;
		<a href="javascript:;" onclick="js.back()" class="zhu"><?=lang('manage.chattitle')?></a> &gt;
		<a href="" class="zhu">会话操作</a>
	</div>
	<div class="mainbody">
		<div style="padding:20px" align="center">
			
			<form name="myform">
			<input type="hidden" name="id" value="<?=$da['id']?>">
			<table width="500px">
			
			<tr>
				<td height="50" align="right"><?=$fieldsobj['picurl']['name']?>&nbsp;&nbsp;</td>
				<td>
				<img src="<?=$data['picurlpic']?>" style="border-radius:50%" id="imgpcid_img" width="80px" height="80px"><br>
				<input style="width:250px" name="picurl" type="hidden" onblur="if(this.value)get('imgpcid_img').src=this.value" placeholder="<?=$fieldsobj['picurl']['msg']?>" class="input" id="imgpcid" value="<?=$data['picurl']?>">
				<button type="button" class="webbtn webbtn-mini" onclick="js.updateface('<?=$fieldsobj['picurl']['name']?>','imgpcid')">上传</button>
				</td>
			</tr>

			
			<tr>
				<td height="50" align="right"><font color=red>*</font><?=$fieldsobj['name']['name']?>&nbsp;&nbsp;</td>
				<td><input style="width:250px" name="name" class="input" value="<?=$data['name']?>"></td>
			</tr>
			
			
			<tr>
				<td height="50" align="right"><?=$fieldsobj['recename']['name']?>&nbsp;&nbsp;</td>
				<td>
					<input style="width:200px" placeholder="<?=$fieldsobj['recename']['msg']?>" readonly id="changerecename" name="recename" class="input" value="<?=$data['recename']?>"><button type="button" class="webbtn" onclick="js.changeuser('changerecename','deptusercheck','<?=$fieldsobj['recename']['name']?>')">选择</button>
					<input type="hidden" name="receid" id="changerecename_id" class="input" value="<?=$data['receid']?>">
				</td>
			</tr>
			
			<tr>
				<td height="50" align="right"><?=$fieldsobj['createname']['name']?>&nbsp;&nbsp;</td>
				<td>
					<input style="width:200px" placeholder="<?=$fieldsobj['createname']['msg']?>" readonly id="changerececreatename" name="createname" class="input" value="<?=$data['createname']?>"><button type="button" class="webbtn" onclick="js.changeuser('changerececreatename','user','<?=$fieldsobj['createname']['name']?>')">选择</button>
					<input type="hidden" name="createid" id="changerececreatename_id" class="input" value="<?=$data['createid']?>">
				</td>
			</tr>
			
			<tr>
				<td height="50" align="right"><?=$fieldsobj['sort']['name']?>&nbsp;&nbsp;</td>
				<td><input style="width:150px" type="number" name="sort" class="input" value="<?=$data['sort']?>">
				<span style="color:gray">越小越靠前</span>
				</td>
			</tr>
			
			
			<tr>
				<td height="50" align="right"></td>
				<td><button type="button" onClick="save(this)" style="padding:8px 20px;border-radius:5px" class="webbtn" >保存</button>&nbsp;<span id="msgview"><a href="javascript:;" onclick="js.back()">返回</a></span></td>
			</tr>
			</table>
			</form>
			
			
		</div>
	</div>
</div>



<?php 
include_once(''.P.'/public/footer.html');
?>
</div>

</body>
</html>